/*
 *  Cero Project - Copyright   2006 The Cero Developement Team 
 *  (Michael Laguerre, Camille Roux, Matthieu Segret, Mathieu Sivade) 
 * 
 *  This program is free software; you can redistribute it and/or modify it 
 *  under the terms of the GNU General Public License as published by the Free 
 *  Software Foundation; either version 2 of the License, or (at your option) 
 *  any later version.
 * 
 *  This program is distributed in the hope that it will be useful, but 
 *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 *  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 *  for more details.
 */

package org.ceroproject.games;

/**
 * Base class for developping rules. When specifying this class, you should
 * override either allowsAction or forbidsAction (or both), and optionnally
 * override compareTo too.
 * 
 * @author Telem
 */
public interface ActionRule extends Rule {

	/**
	 * Indicates whether this rule allows this action to be executed. By
	 * default, no action is allowed.
	 * 
	 * @param action
	 *            the Action to test
	 * @return True if this rule allows the Action 'action', false otherwise.
	 */
	boolean allowsAction(Action action);

	/**
	 * Indicates whether this rule forbids this action to be executed. By
	 * default, no action is forbidden.
	 * 
	 * @param action
	 *            the Action to test
	 * @return True if this rule forbids the Action 'action', false otherwise.
	 */
	boolean forbidsAction(Action action);

	/**
	 * Returns the type of Action ruled by this Rule. If it rules more than one
	 * Action, then it returns null.
	 * 
	 * @return The Class of the only Action ruled or null if multiple actions
	 *         are ruled
	 */
	Class ruledAction();

	public String toString();
}
